/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package automate;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;

/**
 *
 * @author S219
 */
class LancerArreterListener implements ActionListener {
    Diapositives diapo;
    public LancerArreterListener(Diapositives diapo) {
        this.diapo = diapo;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        try {
            switch(diapo.getEtat()){
                case 0 :
                    diapo.MettreEnRoute();
                    diapo.setEtat(2);
                    break;
                case 1 :
                    JLabel image_select = diapo.getImage_selectionnee();
                    System.out.println("on lance à partie de la diapo : "+image_select.getName());
                    diapo.MettreEnRoute();
                    diapo.setEtat(2);                   
                    break;
                case 2 : //on appuie sur pause
                    diapo.mettreEnPause();
                    diapo.setEtat(8);
                    break;
                case 3 :
                    diapo.mettreEnPause();
                    diapo.setEtat(9);
                    break;
                case 4 :
                    diapo.mettreEnPause();
                    diapo.setEtat(10);
                    break;
                case 5 :
                    diapo.mettreEnPause();
                    diapo.setEtat(11);
                    break;
                case 6 :
                    diapo.mettreEnPause();
                    diapo.setEtat(12);
                    break;
                case 7 :
                    diapo.mettreEnPause();
                    diapo.setEtat(13);
                case 8 :
                    diapo.setEtat(2);
                    diapo.remettreEnRoute();
                    break;
                case 9 :
                    diapo.setEtat(3);
                    diapo.remettreEnRoute();
                    break;
                case 10 :
                    diapo.setEtat(4);
                    diapo.remettreEnRoute();
                    break;
                case 11 :
                    diapo.setEtat(5);
                    diapo.remettreEnRoute();
                    break;
                case 12 :
                    diapo.setEtat(6);
                    diapo.remettreEnRoute();
                    break;
                case 13 :
                    diapo.setEtat(7);
                    diapo.remettreEnRoute();
                    break;

            }
        } catch (IOException ex) {
            Logger.getLogger(LancerArreterListener.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}
